﻿<Window x:Class="RSSFeedReader.Views.MoveToFolderView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:RSSFeedReader.ViewModels;assembly=RSSFeedReader.ViewModels"
        Title="Move To Folder"
        WindowStartupLocation="CenterOwner"
        ShowInTaskbar="False"
        WindowStyle="ToolWindow"
        Height="400"
        Width="400">
    <Window.Resources>
        <HierarchicalDataTemplate x:Key="FolderTemplate"
                                  DataType="{x:Type vm:ChannelViewModel}"
                                  ItemsSource="{Binding Children}">
            <Grid Margin="0,2,0,0"
                  Width="Auto">
                <StackPanel Orientation="Horizontal"
                            Margin="0,0,0,5">
                    <Image x:Name="image"
                           Width="18"
                           Height="18"
                           Source="pack://application:,,,/RSSFeedReader.Resources;component/Images/CloseFolder.png"
                           Margin="0,0,3,0" />
                    <TextBlock x:Name="_HeaderTxtBlock"
                               Margin="0,0,5,0"
                               Text="{Binding Path=Title, Mode=OneWay}"
                               Foreground="#FFFFFFFF">
                    </TextBlock>
                </StackPanel>
            </Grid>
            <HierarchicalDataTemplate.Triggers>
                <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type TreeViewItem}, Mode=FindAncestor}}"
                             Value="True">
                    <Setter TargetName="_HeaderTxtBlock"
                            Property="Foreground"
                            Value="#FF767676" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type TreeViewItem}, Mode=FindAncestor}}"
                             Value="True">
                    <Setter TargetName="_HeaderTxtBlock"
                            Property="Foreground"
                            Value="#FF767676" />
                </DataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding Path=IsExpanded, RelativeSource={RelativeSource AncestorType={x:Type TreeViewItem}, Mode=FindAncestor}}"
                                   Value="True" />
                        <Condition Binding="{Binding Path=ChannelType}"
                                   Value="Folder" />
                    </MultiDataTrigger.Conditions>
                    <Setter TargetName="image"
                            Property="Source"
                            Value="pack://application:,,,/RSSFeedReader.Resources;component/Images/OpenFolder.png" />
                </MultiDataTrigger>
            </HierarchicalDataTemplate.Triggers>
        </HierarchicalDataTemplate>
    </Window.Resources>
    <Border Opacity="0.85">
        <Border.Background>
            <LinearGradientBrush EndPoint="0.5,1"
                                 StartPoint="0.5,0">
                <GradientStop Color="#FF0A0A0A"
                              Offset="0" />
                <GradientStop Color="#FF404040"
                              Offset="0.995" />
                <GradientStop Color="#FF000000"
                              Offset="0.525" />
                <GradientStop Color="#FF000000"
                              Offset="0.723" />
                <GradientStop Color="#FF000000"
                              Offset="0.286" />
                <GradientStop Color="#FF1A1A1A"
                              Offset="0.848" />
            </LinearGradientBrush>
        </Border.Background>
        <Border BorderThickness="1,1,1,1">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1"
                                     StartPoint="0.5,0">
                    <GradientStop Color="#4CFFFFFF"
                                  Offset="0" />
                    <GradientStop Color="#00FFFFFF"
                                  Offset="1" />
                </LinearGradientBrush>
            </Border.Background>
            <Grid>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="100" />
                    </Grid.ColumnDefinitions>
                    <TreeView ItemsPanel="{DynamicResource FeedViewItemTemplate}"
                              ItemsSource="{Binding Channels}"
                              ItemTemplate="{StaticResource FolderTemplate}"
                              ItemContainerStyle="{DynamicResource TreeViewItemStyle}" />
                    <StackPanel Grid.Column="1">
                        <Button Content="OK"
                                Height="30"
                                Margin="5"
                                Foreground="White"
                                Template="{StaticResource GlassButton}"
                                Command="{Binding OKCommand}"
                                IsDefault="True"></Button>
                        <Button Content="Cancel"
                                Height="30"
                                Margin="5"
                                Foreground="White"
                                Template="{StaticResource GlassButton}"
                                IsCancel="True"></Button>
                        <Button Content="New..."
                                Height="30"
                                Margin="5"
                                Foreground="White"
                                Template="{StaticResource GlassButton}"
                                Command="{Binding NewFolderCommand}"></Button>
                        <Button Content="Delete"
                                Height="30"
                                Margin="5"
                                Foreground="White"
                                Template="{StaticResource GlassButton}"
                                Command="{Binding DeleteChannelCommand}"></Button>
                    </StackPanel>
                </Grid>
            </Grid>
        </Border>
    </Border>
</Window>
